package com.campusexpresspickup.mapper;

import com.campusexpresspickup.entity.UserResource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.campusexpresspickup.page.UserResourcePage;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 后台资源表 Mapper 接口
 * </p>
 *
 * @author lq
 * @since 2021-11-15
 */
@Mapper
public interface UserResourceMapper extends BaseMapper<UserResource> {

  /**
   * 获取用户所有可访问资源
   */
  List<UserResource> getResourceList(Integer userId);

  /**
   * 根据角色ID获取资源
   */
  List<UserResource> getResourceListByRoleId(@Param("roleId") Integer roleId);

  List<UserResource> findUserResourceList(
      @Param("userResourcePage") UserResourcePage userResourcePage);

  long countByName(String name);
}
